﻿/*
----------------------------------------------------------------------------
%include "/projects/data_commons/lbd_code/lbd_m_merge_runif.sas" /source2;
%merge_runif(ds_in= , ds_out= , l_runif= );
----------------------------------------------------------------------------
*/

%macro merge_runif(ds_in= , ds_out= , l_runif= );

libname illbd "/projects/data_commons/lbd/";

%put ds_in: &ds_in.;
%put ds_out: &ds_out.;
%put l_runif: &l_runif.;

data &ds_out.;
  set &ds_in.;
run;

data &ds_out.;
  set &ds_in.;
run;

data lbd_runif;
  set illbd.lbd_runif;
  keep year lbdid &l_runif.;
run;

proc sort data=&ds_out.;
  by year lbdid;
run;

proc sort data=lbd_runif;
  by year lbdid;
run;

data &ds_out.;
  merge &ds_out.(in=in_main) lbd_runif(in=in_runif);
  by year lbdid;
  if in_main=1;
run;

%mend;

/* End of SAS file */
